package miru.epson;

import miru.epson.common.CommonVal;
import miru.epson.common.type.FillType;
import miru.epson.draw.DrawBallotManager;
import miru.epson.draw.inter.DrawPaperManagerInter;
import miru.epson.dto.Ballot;
import miru.epson.dto.Label;
import miru.epson.properties.InitFromProperties;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.ImageView;

public class BallotDetailActivity extends Activity {
	ImageView detailImg;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ballot_detal_view);
		
		detailImg = (ImageView) findViewById(R.id.ballotImg);
		
		
		String titleName = getIntent().getStringExtra("titleName");
		String subTitleName = getIntent().getStringExtra("subTitleName");
		
		int ballotType = getIntent().getIntExtra("ballotType", 0);
		int candidateNum = getIntent().getIntExtra("candidateNum", 0);
		int ballotColor = getIntent().getIntExtra("ballotColor", Color.WHITE);
		
		InitFromProperties prop = new InitFromProperties(this, ballotType, candidateNum);
		
		Ballot ballot = prop.getBallot();
		
		ballot.setTitleName(titleName);
		ballot.setSubTitleName(subTitleName);
		ballot.setBoxColor(ballotColor);
		ballot.setFillType(FillType.FILL_FULL);
		ballot.setCandidate(CommonVal.candidateForTest);
		
		Label label = new Label();
		
		DrawPaperManagerInter ballotManager = new DrawBallotManager(this, ballot, ballotType);
		ballotManager.drawPaperToBitmap();
		Bitmap ballotBitmap = ballotManager.getBitmap();
		
		detailImg.setImageBitmap(ballotBitmap);
		
	}

}
